#coding=utf-8

import sys
import MySQLdb

conn = MySQLdb.connect(
            host="localhost",
            user="root",
            passwd="oseasy",
            db="test",
            charset="utf8"
        )
cursor = conn.cursor()

try:
    cursor.execute("DROP TABLE IF EXISTS abc")
    cursor.execute("CREATE TABLE IF NOT EXISTS abc(id int(4) primary key)")
    for i in range(10):
        cursor.executemany("insert into abc values(%d)" % i)

    print "Number of rows selected:%d" % cursor.rowcount
except MySQLdb.Error, e:
    print "Error %d:%s" % (e.args[0],e.args[1])

sys.exit(1)
conn.commit()
conn.close()
